#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    int cnt = 0, p = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] == 0) cnt++, p = i + 1;
    }
    if(cnt == 0) {
        cout << 1 << endl;
        cout << 1 << ' ' << n << endl;
        return;
    }
    if(cnt == 1) {
        cout << 2 << endl;
        if(p == n) {
            cout << n - 1 << ' ' << n << endl;
        }else if(p == 1) {
            cout << 1 << ' ' << 2 << endl;
        }else{
            cout << p << ' ' << p + 1 << endl;
        }
        cout << 1 << ' ' << n - 1 << endl;
        return;
    }
    int p1 = -1;
    for(int i = 0; i < n; i++) {
        if(a[i] == 0) {
            p1 = i + 1;
            break;
        } 
    }
    if(a[0] == 0 && a[n - 1] == 0) {
        cout << 3 << endl;
        cout << 1 << ' ' << 2 << endl;
        cout << 2 << ' ' << n - 1 << endl;
        cout << 1 << ' ' << 2 << endl;
    }else{
        cout << 2 << endl;
        cout << p1 << ' ' << p << endl;
        cout << 1 << ' ' << n - (p - p1) << endl;
    }

}

signed main() {
    int t = 1;
    cin >> t;
    while(t--) solve();
    return 0;
}